#ifndef DISCOVERMUSICMODULE_H
#define DISCOVERMUSICMODULE_H

#include <QVBoxLayout>
#include <QWidget>
#include<list>
#include"musicinfo.h"
#include<thread>
using namespace  std;
namespace Ui {
class DiscoverMusicModule;
}


enum class MusicFlag{
    addmusic,
    delmuisc
};

class DiscoverMusicModule : public QWidget
{
    Q_OBJECT

public:
    explicit DiscoverMusicModule(QWidget *parent = nullptr);
    ~DiscoverMusicModule();
    inline void setinfo(QString nameid,QString passwd){
         m_nameid=nameid;
         m_passwd=passwd;
    }
public:
    void addlovemusic(QString title);
    void dellovemusic(QString title);
    static void threadaddmusic(QString nameid,QString passwd,QString title,MusicFlag flag,DiscoverMusicModule*D);
private slots:
    void on_exit_clicked();
signals:
    void showwidget();  //显示窗口信号
    void playmusic(tcpclient*client,QString title);
    void loadingcompleted();  //加载歌曲完成
    void NotifyShow(QString str1,QString res);        //通知显示
private:
    Ui::DiscoverMusicModule *ui;
    list<MusicInfo*>musiclist;   //存储音乐列表
    QVBoxLayout *m_pLayout=nullptr;
    QString m_nameid;
    QString m_passwd;
};

#endif // DISCOVERMUSICMODULE_H
